package com.liveinstars.im.common.exception;

import com.onepiece.shipelves.common.Result;
import com.onepiece.shipelves.common.enums.BaseExceptionEnum;
import com.onepiece.shipelves.common.exception.BaseException;
import lombok.Data;

/**
 * @author: zhouze
 * @date: 2020/3/26
 */
@Data
public class IMRuntimeException extends RuntimeException implements BaseException {

    private String code;

    private String message;



    public IMRuntimeException(BaseExceptionEnum baseExceptionEnum) {
        this.code = baseExceptionEnum.getExceptionCode();
        this.message = baseExceptionEnum.getExceptionMessage();
    }

    public IMRuntimeException(String code, String message) {
        this.code = code;
        this.message = message;
    }
    @Override
    public Result createResult() {
        Result result = new Result();
        result.setCode(this.code);
        result.setMessage(this.message);
        return result;
    }
}
